#ifndef IOMANAGER_H
#define IOMANAGER_H

#include <QDebug>

#include <QFile>

#include "uml/projects/umlproject.h"
#include "gui/mainwindow/mainwindow.h"
#include "io/reader/xmi/xmireader.h"
#include "io/writer/xmi/xmiwriter.h"
#include "io/writer/java/javawriter.h"

class IOManager: public QObject
{
    Q_OBJECT
public:

    enum FileType {
            XMI,
            WMI
        };

    IOManager();

    void loadProject(QString filePath);
    void saveProject(UmlProject *project);

    void exportXMI(UmlProject *project, QString filePath);
    void importXMI(QString filePath);

    void exportToJava(UmlProject *project, QString filePath);

    void setMainWindow(MainWindow *mainWindow);

protected:
    QString _filePath;

    XMIReader _xmiReader;
    XMIWriter _xmiWriter;

    JavaWriter _javaWriter;

    MainWindow *_mainWindow;

protected slots:
    void readerIsFinished(UmlProject *project, DatatypeDictionary *dataTypes);
};

#endif // IOMANAGER_H
